1. Field of the Invention
This patent relates in general to a recording method. More specifically, this patent relates to a recording method for improving interrupted interferences.
2. Description of Related Art
Digitalized data is easily to be stored and modified. Therefore, information, which is originally stored in an analog form, such as voice, image etc, is gradually stored in the digital form. Digitalized voice is digital audio data and comprises many samples. The quality of the digitalized voice is dependent on the sampling rate (sample number per second) and the resolution of each sample. Taking the quality of an audio CD as an example, the sampling rate is 44 k (k=1000) samples per second and the sample resolution is 16 bits. The higher the sampling rate or sample resolution is, the better the voice quality becomes. However, the required memory space for storing the audio data also increases.
FIG. 1 is a block diagram of a conventional recording apparatus 100. The recording apparatus 100 can be used in a computer system. The recording apparatus 100 comprises an audio processing unit 104 and a controlling unit 106. The computer system comprises a memory 102. The operating system of the computer allocates the memory based on a unit of sample to the recording apparatus 100 according to the amount required for recording, and the allocated memory refers to buffers. For example, if the operating system requires 1024 samples, the size of the allocated buffers is the space required for storing these samples.
The recording apparatus 100 receives an analog audio data (denoted as A in FIG. 1) according to a command issued by the operating system of the computer system, and then converts the analog audio data A to a digital audio data (denoted as D in FIG. 1) that will be stored in the buffers allocated by the operating system. The audio processing unit 104 has pointers, each pointer indicates a buffer address that can be used. After the audio processing unit 104 performs an analog-to-digital conversion, the audio processing unit 104 outputs the digital audio data D to a buffer directed by the pointer.
The conventional recording apparatus uses a dual-buffering method, i.e., two buffers are used for temporal storage in the recording process. The recording is a real-time process, and no interrupt is allowed in the recording process. Therefore, after the first buffer is full, there must be another buffer needed for the recording process, which means that two buffers are required at the same time. FIG. 2 shows schematically the conventional dual-buffering recording method. The operating system allocates buffers B(0), B(1), B(2) and B(3) for recording. The pointer 20 includes two pointer addresses 20a, 20b, pointing to the buffers B(0) and B(1) respectively. During recording data to the buffer B(0), the driver program prepares the buffer B(1) as the next recording block. During recording data to the buffer B(1), the driver program releases the buffer B(0) to the operating system for further process. Next, according to the address pointed by the pointer 20a, the buffer B(2) is prepared. The above process is repeatedly performed until the recording process is finished.
FIG. 3 is a flow chart of a conventional dual-buffering recording method. At the beginning of the recording process, at step 300, the pointer addresses 20a, 20b in the pointer 20 are respectively pointed to the buffer B(0) and B(1). Then, at step 310 the data begins to be recorded to the buffer B(0), and at the same time, the driver prepares the buffer B(1) at step 312. Next, when the buffer B(0) is completely recorded, data begin to be recorded to the buffer B(1) at step 320, and at the same time, the buffer B(0) is released to the operating system at step 322. Next, the driver prepares the buffer B(2) at step 324. When the buffer B(1) is completely recorded, data begins to be recorded to the buffer B(2) at step 330. At the same time, the driver releases the buffer B(1) to the operating system at step 332. Then, the buffer B(3) is further prepared at step 334. When the buffer B(2) is completely recorded, data begins to be recorded to the buffer B(3) at step 340. At the same time, the driver releases the buffer B(2) to the operating system at step 342. When the buffer B(3) is completely recorded, the buffer B(3) is then released to the operating system at step 350, finishing the recording process.
Steps 312, 324 and 334 are used for preparing the next buffer. However, if the buffer allocated by the buffer is too small, a size of 2 samples for example, errors occur in the recording process. Take steps 310 and 312 as an example. If the buffer B(0) prepared by the operating system is too small, the buffer will be soon full (step 310) and the data will begin to be recorded to the next buffer indicated by the pointer 20b. At this time, the buffer B(1) that might be prepared at step 312 is not prepared. Namely, the address of the buffer B(1) is not written to the pointer 20b, and therefore, data will be recorded to wrong positions, so that the released buffer B(1) at step 332 does not contain any information.
FIG. 4 shows a recorded waveform according to the conventional dual-buffering recording method. The input analog audio information is a sinusoidal waveform. Shown in the figure, there is a silent period at the midpoint of the recorded waveform, due to the cause that the driver does not have enough time to prepare the buffer. As a result, discontinuous staccatos is heard.
The size of the buffer for each recording is determined by the operating system. In general, the operating system allocates a buffer having a size of 1024 samples each time. However, if the buffer size given by the operating system is too small, 2 samples for example, the next buffer address cannot be written to the pointer table in time, and data of whole buffer will be lost.